class Player(object):
    numbers = 0
    levels = ['青铜', '白银', '黄金', '铂金', '钻石', '王者']

    def __init__(self, name, age, city, level):
        self.name = name
        self.age = age
        self.city = city
        if level not in Player.levels:
            raise Exception("段位设置错误！")
        else:
            self.level = level
        Player.numbers += 1

    def level_up(self):
        current = self.levels.index(self.level)
        if current < len(self.levels) - 1:
            self.level = self.levels[current + 1]

    def show(self):  # 实例的方法
        print(f'我是荣耀王者的第{Player.numbers}个玩家，我的名字是{self.name}，我来自{self.city}，我的段位是{self.level}')

    def get_weapon(self, weapon):
        self.weapon = weapon

    def show_weapon(self):
        return self.weapon.show_weapon()


class Weapon(object):
    numbers = 0
    max_damage = 10000
    levels = ['青铜', '白银', '黄金', '铂金', '钻石', '王者']

    def __init__(self, name, level, damage):
        self.name = name
        self.level = level
        self.damage = damage
        if damage > Weapon.max_damage:
            raise Exception("最大伤害值是10000，请重试！")
        if level not in Weapon.levels:
            raise Exception("段位设置错误！")

    def show_weapon(self):
        for k, v in self.__dict__.items():
            print(k, v)


mia = Player('mia', '19', '上海', '青铜')
mia.show()
mia.level_up()
mia.show()
mia.level_up()
mia.show()
mia.level_up()
mia.show()
mia.level_up()
mia.show()
mia.level_up()
mia.show()
mia.level_up()
mia.show()
gun = Weapon('gun_magic', '钻石', 5000)
mia.get_weapon(gun)
mia.show_weapon()